This repository contains code that demonstrate the application of a Masked Autoregressive Flow to estimate the hidden states of an implicit Hidden Markov Model, supporting the above paper, published in AISTATS 2024.
We are using the sbi
package heavily. See the requirements.txt
The base simulators for both the Lotka-Volterra and the Prokaryotic models are implemented inC++
. These need compilation.
Go to ./CPP
directory and then compile by using
python setup.py build_ext -i
.
Then rename the generated *.so files to lvssa.so
and pkyssa.so
.
To run the stochastic Lotka-Volterra example model:
python lotkavolterra_nlfi.py
This will run sequential NLFI to infer the posterior parameters and IDE (and SMC) for hidden states. Also, run:
python lotkavolterra_abc.py
for infering the states using ABC-SMC. Once these are finished, run
python lotkavolterra_plots.py
for visualisation.
Follow the above for the Prokaryotic model. For running the Nonlinear Gaussian statespace model:
python statespace.py